package com.zjt.smart.ui.activity.test;

import android.support.v7.widget.RecyclerView;

import com.zjt.smart.mvp.presenter.BaiduImageListPresenter;
import com.zjt.smart.mvp.view.LoadView;
import com.zjt.smart.ui.adapter.BaiduImageListAdapter;
import com.zjt.smart.ui.adapter.base.BaseAdapter;
import com.zjt.smart.ui.base.PageActivity;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <P>Company: </p>
 *
 * @author zhengjianting
 * @time 2017/11/3 0003 下午 2:34
 */

public class BaiduImageStaggerActivity extends PageActivity {

    BaiduImageListPresenter baiduImageListPresenter = new BaiduImageListPresenter();

    @Override
    protected BaseAdapter createAdapter() {
        return new BaiduImageListAdapter(this);
    }

    @Override
    protected RecycleType getRecycleViewType() {
        return RecycleType.STAGGER;
    }

    @Override
    protected int getSpanCount() {
        return 2;
    }

    @Override
    public boolean canLoadMore() {
        return true;
    }

    @Override
    protected RecyclerView.ItemDecoration createItemDecoration() {
        return null;
    }

    @Override
    protected boolean canLoadCache() {
        return false;
    }

    @Override
    protected void onLoadPage(int pageNum, LoadView view, boolean fromCache) {
        baiduImageListPresenter.loadImageList(view, fromCache, pageNum - 1, 10, "明星", "全部");
    }

    @Override
    protected void onDestroy() {
        baiduImageListPresenter.destroy();
        super.onDestroy();
    }
}
